<template>
    <div class="dialog">
        <div class="background" @click="giveUp()"></div>
        <div class="dialogdiv">
            <label>动态审核</label>
            <div class="message">
                <div class="perdiv">
                    <label><strong>用户姓名&nbsp;&nbsp;</strong></label>
                    <input type="text" disabled :value="$store.state.trendAdmin.nickname">
                </div>
                <div class="perdiv">
                    <label><strong>用户年龄&nbsp;&nbsp;</strong></label>
                    <select disabled>
                        <option>19</option>
                        <option>20</option>
                        <option>21</option>
                        <option>22</option>
                        <option>23</option>
                        <option>24</option>
                    </select>
                </div>
                <div class="perdiv">
                    <label><strong>用户状态&nbsp;&nbsp;</strong></label>
                    <select disabled>
                        <option>未禁用</option>
                        <option>已禁用</option>
                    </select>
                </div>
                <div class="perdiv">
                    <label><strong>动态分类&nbsp;&nbsp;</strong></label>
                    <select disabled>
                        <option>摄影</option>
                        <option>学习</option>
                        <option>旅游</option>
                        <option>美食</option>
                        <option>娱乐</option>
                    </select>
                </div>
                <div class="photo">
                    <div class="photoText">
                        <label><strong>动态图片</strong></label>
                    </div>
                    <div class="pictures">
                        <span
                        v-for="(photo,index) in $store.state.trendImg" 
                        :key="index"
                        >
                            <img :src="photo">
                        </span>
                    </div>
                </div>
                <div class="text">
                    <div class="textTop">
                        <label><strong>动态文字</strong></label>
                    </div>
                    <div class="textarea">
                        <span>
                            {{$store.state.trendAdmin.content}}
                        </span>
                    </div>
                </div>
                <div class="perdiv buttons">
                    <button class="yesbtn" @click="examine(1)">通过</button>
                    <button class="deleteUser" @click="examine(2)">不通过</button>
                    <button class="giveup" @click="giveUp()">取消</button>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
import axios from 'axios'
export default {
    name: 'TrendDialog',
    methods:{
        giveUp(){
            this.$store.state.dialog = 0
        },
        examine(a){
            axios.post(`http://123.57.251.41:8080/admin-forum/auditForum?id=${this.$store.state.trendAdmin.bodyId}&code=${a}`,{headers:{'Authentication-Token': JSON.parse(sessionStorage.getItem("token"))}}).then(
                response =>{
                    console.log('该动态通过审核了')
                    console.log(response.data.data.list)
                    this.$store.state.dialog = 0
                },
                error =>{
                    console.log(id)
                    alert("该动态未通过审核",console.log(error))
                    this.$store.state.dialog = 0
                }
            )
        }
    },
}
</script>

<style>
</style>